Sending files

The following examples demonstrate how to send single or multiple files as part of an HTTP request.

Send a single file

This sends a single file as a binary stream. The Content-Type HTTP Header is set to application/octet-stream when using this content type unless a different Content-Type header value has been specified in the Web API action definition.

Web API definition

An action in an API definition uses the POST method and Single File for the body content. The File Parameter Name creates an input parameter named Release Notes in processes that use this action.

Process

In Process Studio, a process contains a data item called Notes with a Data Type of Binary into which a file has been imported.

An action stage in the process uses the API definition and references the Notes data item as the value for the input parameter.

When the API is called, the file imported into the data item is sent as part of the HTTP request.

Send multiple files

Multiple files are sent in a single request using the multipart/form-data content-type.

Web API definition

An action in an API definition uses the POST method and Multiple Files for the body content. The File Parameter Name creates an input parameter named Documents in processes that use this action.

Process

A process contains a collection item called Files into which a number of files have been imported.

The third-party Web API may require the File Name, Field Name, and Content Type fields to be populated. Please refer to the third-party Web API documentation.

Collections passed into input parameters are expected to use the following specified schema:

Name

Data Type

Is Required

Description

File

Binary

True

The file to be sent.

File Name

Text

False

Used to populate the filename header for this file's section in the multi-part form body

Field Name

Text

False

Used to populate the name header for this file's section in the multi-part form body

Content Type

Text

False

Used to populate the Content-Type header for this file's section in the multi-part form body. If a value is not specified, application/octet-stream is used by default.

When creating a collection, the required schema can be imported by clicking Import Fields from the Collection Properties and selecting a parameter from required web API action.

An action stage in the process uses the API definition and references the Files data item as the value for the input parameter.

When the API is called, the file is sent as part of the HTTP request.